{"componentChunkName":"component---src-templates-blog-template-js","path":"/blog/find_changes_between_commits","result":{"data":{"markdownRemark":{"html":"<p>There are a lot of changes in the data contract between two commits. These are mixed into a load of other (functional, non-contract) changes. I want to be able to see them easily. How do I do this?</p>\n<p>Option 1 (step by step)</p>\n<pre><code># Get the names of the files changed between the two commits\ngit diff --name-only HEAD~1 HEAD > c:/dave/changes.diff\n\n# Filter to those with contract changes\ngrep Atmos/Smt/OperationOptimiserV2/Contracts/ c:/dave/changes.diff > c:/dave/contractfileschanged.diff\n\nwhile IFS= read -r f; do\n  if [ -f \"$1/${f##*/}\" ]; then\n    echo rm -- \"$1/${f##*/}\"\n  fi\n  echo $f\n  git diff  HEAD~1 HEAD $f >> c:/dave/contractchanges.diff\ndone &#x3C; c:/dave/contractfileschanged.diff\n</code></pre>\n<p>Option 2 (inline)</p>\n<pre><code>echo \"\" > c:/dave/contractchanges.diff\n\n# Pipe the git diff output into grp\nfor f in $(git diff --name-only HEAD~1 HEAD | grep Atmos/Smt/OperationOptimiserV2/Contracts/ )\n   do\n   git diff  HEAD~1 HEAD $f >> c:/dave/contractchanges.diff\ndone\n</code></pre>\n<p>Option 2a (Option 2 in a single line)</p>\n<pre><code>for f in $(git diff --name-only HEAD~1 HEAD | grep Atmos/Smt/OperationOptimiserV2/Contracts/ );    do    git diff  HEAD~1 HEAD $f >> c:/dave/contractchanges.diff; done\n</code></pre>","frontmatter":{"date":"January 05, 2021","slug":"/blog/find_changes_between_commits","title":"Using bash to find changes between commits in key files"}}},"pageContext":{"slug":"/blog/find_changes_between_commits"}},"staticQueryHashes":["3649515864"]}